<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "token".
 *
 * @property string $token_id 令牌ID
 * @property string|null $access_token 请求令牌
 * @property string|null $refresh_token 刷新令牌
 * @property int|null $refresh_time 刷新时间
 * @property int|null $token_duration 令牌失效时间
 */
class Token extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'token';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['token_id'], 'required'],
            [['refresh_time', 'token_duration'], 'integer'],
            [['token_id', 'access_token', 'refresh_token'], 'string', 'max' => 255],
            [['token_id'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'token_id' => '令牌ID',
            'access_token' => '请求令牌',
            'refresh_token' => '刷新令牌',
            'refresh_time' => '刷新时间',
            'token_duration' => '令牌失效时间',
        ];
    }
}
